/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package business;

import data.ServicosData;
import java.util.ArrayList;
import java.sql.SQLException;

/**
 *
 * @author Mário
 */
public class Servicos {

    ServicosData data;

    public Servicos() {
        data = new ServicosData();
    }

    public void addServico(String descricao, String nome, double preco) throws Exception{
        data.addServico(descricao, nome, preco);
    }

    public void removerServico(int cod) throws Exception{
        data.removerServico(cod);
    }

    public ArrayList<Servico> consultarListaServicos() throws SQLException {
        ArrayList<Servico> servicos ;
        servicos = data.consultarServicos();
        return servicos;
    }

    public void alteraOpcoesServicos(int cod,String nome,String desc) throws SQLException {
        data.alterarOpcoesServicos(cod, nome, desc);
    }

    public void setPrecoServico(int codServico,double preco) throws SQLException {
        data.setPrecoServico(codServico, preco);
    }


    public ArrayList<Servico> consultarServicos() throws SQLException {
        return data.consultarServicos();
    }

    public ArrayList<Servico> consultarServCliente(int codCliente) throws SQLException {
        return data.consultarServCliente(codCliente);
    }

    public ArrayList<Servico> consultaSerFaltamCliente(int codCliente) throws SQLException {
        ArrayList<Servico> lista = new ArrayList<Servico>();
        ArrayList<Servico> servicos = consultarServCliente(codCliente);
        for(Servico s : consultarServicos()){
            if (servicos.contains(s)){
            }
            else{
                lista.add(s);
            }
        }
        return lista;
    }

}
